home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 9945 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What are the best C programming language books for beginner?
  5. Date: 14 Mar 1996 08:33:26 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4i9homINNa10@keats.ugrad.cs.ubc.ca>
  8. References: <313FA4BD.41C67EA6@dragon.taiwan.ti.com> <3a7cc$15141.38a@news.comet.net> <Pine.OSF.3.91.960313150356.30507A-100000@io.UWinnipeg.ca> <4i81un$4gc@solutions.solon.com>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <4i81un$4gc@solutions.solon.com>,
  12. Peter Seebach <seebs@solutions.solon.com> wrote:
  13. >In article <Pine.OSF.3.91.960313150356.30507A-100000@io.UWinnipeg.ca>,
  14. >Bill Simpson  <wsimpson@uwinnipeg.ca> wrote:
  15. >>A simple litmus test:  look for int main(void).  Unbelevably, you still 
  16. >>get many versions other than this (including the holy K&R book, which the 
  17. >>authors have not bothered to ANSI-ize so far as I know).
  18. >
  19. >K&R is fully ANSI, with one (1) exception I know of (*study* page 117.).
  20.  
  21. There is a funny "a" character lying on its side in the top right corner.
  22.  
  23. Ooh! I think I just spotted a  ``*++argv[0]'' in there. Ouchie... These
  24. argv[] pointers are not modifiable. Is that it is there more?
  25.  
  26. >I have found one piece of advice I disagree with, one mistake, and one
  27. >typo.  (Missing " on page 114.  I didn't find it; dmr pointed it out
  28. >when I sent in a bug report on the one on 117.)
  29. >
  30. >It has been ANSI-ized since before there was ANSI C.
  31.  
  32. There is one more thing that I found. Somewhere in the book it suggests that
  33. you use a cast with malloc(), whereas ANSI doesn't require it. For example,
  34. on page 142 in the talloc function.
  35.  
  36. The paragraph above reads:
  37.  
  38.     ``In C, the proper method is to declare that malloc returns a pointer
  39.     to void, then explicitly coerce the pointer into the desired type with        a cast.''
  40.  
  41. Of course, the proper method is to leave it out if you like, as blessed by
  42. ANSI, and it is in fact preferrable.
  43.  
  44. The one other fault I find with the book is that it gives the imporession
  45. that the standard library functions are ordinary C functions. It gives `` sample
  46. implementations'' of some of them, but without appropriate caveats.
  47.  
  48. It leads programmers who haven't read the standard to believe that they
  49. can, for instance, write their own malloc() with external linkage.
  50. -- 
  51.  
  52.